<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>管理中心</title>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript">
    attachmentnum=<!--{$imgcount}-->;
function addattachment(){
    attachmentnum++;
    if(attachmentnum>=8){alert('最多只能加8张图片'); return false;}
document.getElementById('hompage_img').innerHTML+="<div style=\"padding:4px 0\"'><input type=\"file\" class=\"input\" name=\"hompage_images[]\" />&nbsp;<a href=\"javascript:;\" onclick=\"removeattachment(this)\"> [-]</a></div>";
}
function removeattachment(obj){
var parent=obj.parentNode;
	parent.innerHTML='';
	parent.parentNode.removeChild(parent);
  attachmentnum--;
}
function checksuffix(){
    $("#hompage_img input:file").each(function(){
        var sourceStr = $(this).attr("value");
         var FileListType="jpg,JPG,gif,GIF,jpeg,JPEG,png,PNG";
         var destStr = sourceStr.substring(sourceStr.lastIndexOf(".")+1,sourceStr.length)
         if(FileListType.indexOf(destStr) == -1){
          alert("只允许上传jpg,JPG,gif,GIF,jpeg,JPEG,png,PNG文件");
          return false;
        }
        return true;
    });
}
</script>
<style type="text/css">
.template{border:1px solid #eee;padding:3px;width:60px;height:60px;}
.template_select{border:3px solid red;padding:1px;width:60px;height:60px;}
</style>
</head>
<body>
<!--{include file="top.htm"}-->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="150" valign="top"><!--{include file="left.htm"}--></td>
<td valign="top">

<div class='title'>&raquo;&nbsp;图片轮播管理</div>
<div class='item'>
<form action="?action=config&do=config_imgs" method="post" enctype="multipart/form-data" onsubmit="checksuffix();">
    <div id="hompage_img" style="line-height:1.8"><br/>
        <!--{foreach from=$imgshome item=img}-->
        <!--{if $img!=""}-->
        <input type="text" size="30" name="imgup[]" value="{$img}"/> <label><input type="checkbox" name="delimg[]" value="{$img}"> 删除</label><br/>
        <!--{/if}-->
        <!--{/foreach}-->
        <!--{if imgcount<8}-->
        <input type="file" name="hompage_images[]" class="input"/>
        &nbsp;<a href="javascript:;" onclick="addattachment(this)">[+]</a>
        <!--{/if}-->
    </div>
    <input type="submit" value="提交" class="button"/>
</form>
<br /><br />
 </div>

</td>
</tr>
</table>
</body>
</html>